<?php
//error_reporting(E_COMPILE_ERROR|E_ERROR|E_CORE_ERROR);
require('./roots.php');
require_once('./classes/rbac.php');
require($root_path.'include/inc_environment_global.php');

/**
* CARE2X Integrated Hospital Information System beta 2.0.1 - 2004-07-04
* GNU General Public License
* Copyright 2002,2003,2004,2005,2006 Elpidio Latorilla
* elpidio@care2x.org, 
*
* See the file "copy_notice.txt" for the licence notice
*/

define('LANG_FILE','rbac.php');
define('NO_2LEVEL_CHK',1);
require_once($root_path.'include/inc_front_chain_lang.php');

$thisfile=basename(__FILE__);
$breakfile='rbac.php';
$action='FuncionCrearPermiso.php'.URL_APPEND;

require_once($root_path.'include/care_api_classes/class_core.php');
$core=new Core;

require_once($root_path.'include/care_api_classes/class_interconsulta.php');
include_once($root_path.'include/inc_photo_filename_resolve.php');

$msj = '';
?>
<script type="text/javascript" src="chromejs/chrome.js">


</script>

<?php


# Start Smarty templating here
/**
* LOAD Smarty
*/

# Note: it is advisable to load this after the inc_front_chain_lang.php so
# that the smarty script can use the user configured template theme

require_once($root_path.'gui/smarty_template/smarty_care.class.php');
$smarty = new smarty_care('common');

$smarty->assign('lang',$lang);
$smarty->assign('root_path',$root_path);
$smarty->assign('append',URL_APPEND);
$smarty->assign('breakfile',$breakfile);
$smarty->assign('action',$action);
$smarty->assign('reg',1);
$smarty->assign('currentUser', $_SESSION['sess_login_userid']);

if(isset($_GET['result'])){
    $message=$_GET['result'];
    if($message==NULL)
	$smarty->assign('Message',$LDCrearPermError);
    if($message==FALSE)
	$smarty->assign('Message',$LDNoPermiso);
    if($message==TRUE)
	$smarty->assign('Message',$LDCrearPerm);
}

$rbac= new rbac();
//echo ("login ".$_SESSION['sess_login_username']);
$role=$rbac->Buscar_rol(NULL,$_SESSION['sess_login_username']);
$resource=$rbac->Buscar_recurso(NULL,$_SESSION['sess_login_username']);
//var_dump($gui);
$smarty->assign('role',$role);
$smarty->assign('resource',$resource);
$smarty->assign('sToolbarTitle',$LDRbac1);

$smarty->assign('LDCategorias',$LDCategorias);
$smarty->assign('LDSeleccionar',$LDSeleccionar);
$smarty->assign('LDEliminar',$LDEliminar);
$smarty->assign('LDCrearPermisos',$LDCrearPermisos);

$smarty->assign('LDUsuario',$LDUsuario);
$smarty->assign('LDCrearUsuario',$LDCrearUsuario);
$smarty->assign('LDModificarUsuario',$LDModificarUsuario);
$smarty->assign('LDEliminarUsuario',$LDEliminarUsuario);
$smarty->assign('LDBuscarUsuario',$LDBuscarUsuario);

$smarty->assign('LDRol',$LDRol);
$smarty->assign('LDCrearRol',$LDCrearRol);
$smarty->assign('LDModificarRol',$LDModificarRol);
$smarty->assign('LDEliminarRol',$LDEliminarRol);
$smarty->assign('LDBuscarRol',$LDBuscarRol);

$smarty->assign('LDRecurso',$LDRecurso);
$smarty->assign('LDCrearRecurso',$LDCrearRecurso);
$smarty->assign('LDModificarRecurso',$LDModificarRecurso);
$smarty->assign('LDEliminarRecurso',$LDEliminarRecurso);
$smarty->assign('LDBuscarRecurso',$LDBuscarRecurso);

$smarty->assign('LDCrear',$LDCrear);
$smarty->assign('LDPermiso',$LDPermiso);
$smarty->assign('LDActDesactPermiso',$LDActDesactPermiso);

$smarty->assign('LDNombre',$LDNombre);
$smarty->assign('LDEstado',$LDEstado);
$smarty->assign('LDActivo',$LDActivo);
$smarty->assign('LDInactivo',$LDInactivo);

$smarty->assign('LDAsignacion',$LDAsignacion);
$smarty->assign('LDAsignarRol',$LDAsignarRol);
$smarty->assign('LDAsignarBuscar',$LDAsignarBuscar);
$smarty->assign('LDAsignarRevocar',$LDAsignarRevocar);
$smarty->assign('LDAsignarModifi',$LDAsignarModifi);

$smarty->assign('LDAsigPermiso',$LDAsigPermiso);
$smarty->assign('LDRevoPermiso',$LDRevoPermiso);

$smarty->assign('sMainBlockIncludeFile','rbac/PermisoCrear.tpl');

/**
* show Template
*/
$smarty->display('common/mainframe.tpl');
?>
